/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.mach.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import org.springblade.core.tool.api.R;
import org.springblade.mach.entity.DrawingUpload;
import org.springblade.mach.entity.FileImgTypeList;
import org.springblade.mach.entity.FileThreeTypeList;
import org.springblade.mach.entity.FileTyeList;
import org.springblade.mach.vo.DrawingUploadVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.mach.vo.SignDrawingUploadVO;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 *  服务类
 *
 * @author LY
 * @since 2021-03-09
 */
public interface IDrawingUploadService extends BaseService<DrawingUpload> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param drawingAttach
	 * @return
	 */
	IPage<DrawingUploadVO> selectDrawingAttachPage(IPage<DrawingUploadVO> page, DrawingUploadVO drawingAttach);

	/**
	 * 发起事务-> 撤回
	 * @param drawingId
	 * @return
	 */
	boolean updateDrawingStatus(Long drawingId, Integer statusCode);

	/**
	 * 获取设备详情
	 * @param wordOrderNo 工单号
	 * @param drawingNumber 设备编号
	 * @return
	 */
	DrawingUpload getDrawingDetail(String wordOrderNo, String drawingNumber);

	/**
	 * 保存附件接口实现方法
	 * @param file 上传的文件
	 * @param threeFile 3D图纸压缩包
	 * @param imgFile 图纸预览截图
	 * @param drawingUpload
	 * @param fileTyeList
	 * @param fileThreeTypeList
	 * @param fileImgTypeList
	 * @return
	 */
	R<Map<String, Object>> saveUploadAttach(MultipartFile[] file,
	                                        MultipartFile[] threeFile,
	                                        MultipartFile[] imgFile,
	                                        @ModelAttribute("drawingUpload") DrawingUpload drawingUpload,
	                                        @ModelAttribute("fileTyeList") FileTyeList fileTyeList,
	                                        @ModelAttribute("fileThreeTypeList") FileThreeTypeList fileThreeTypeList,
	                                        @ModelAttribute("fileImgTypeList") FileImgTypeList fileImgTypeList);

	R removeAttach(String ids);

	Boolean checkExcel (String fileName);

	R<Map<String, Object>> saveSignAttach(SignDrawingUploadVO signDrawingUploadVO);

	R handleDrawingAttach(Long uploadId, String taskDefinitionKey);

	/**
	 * @Author zhp
	 * @Description //TODO
	 * @Date 17:31 2022/1/20
	 * @param drawingId
	 * @return void
	 * 拆分BOM
	*/
	void getDrawingBom(Long drawingId) throws Exception;

	List<DrawingUpload> getDrawingExcelLinkName(DrawingUpload drawingUpload);

	/**
	 * @Author zhp
	 * @Description //TODO
	 * @Date 18:28 2022/1/20
	 * @param drawingUploadId
	 * @param status
	 * @return void
	 * 修改图纸上传与图号状态
	*/
	Boolean updateDrawingUploadStatus(Long drawingUploadId, int status) throws Exception;

	List<String> checkBom(MultipartFile[] file);

	List<String> verifyBom(MultipartFile[] file);

	void applyNumberCheck(MultipartFile[] planeFile, List<String> codeErrorList);
}
